// license-header java merge-point
package edu.uoc.tfc.gui.parts.modificacio;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionMapping;

import edu.uoc.tfc.gui.common.Level;
import edu.uoc.tfc.gui.common.MissatgeAjax;
import edu.uoc.tfc.gui.common.ResultatAccioAjaxVO;

/**
 * @see edu.uoc.tfc.gui.parts.modificacio.ModificaPartController
 */
public class ModificaPartControllerImpl extends ModificaPartController
{
    /**
     * @see edu.uoc.tfc.gui.parts.modificacio.ModificaPartController#modificaPart(org.apache.struts.action.ActionMapping, edu.uoc.tfc.gui.parts.modificacio.ModificaPartForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
     */
    public final void modificaPart(ActionMapping mapping, edu.uoc.tfc.gui.parts.modificacio.ModificaPartForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
    {
    	getPartService().modificaPart(
    			form.getPart(),
    			form.getAsseguradoraId(),
    			form.getTipusSinistreId(),
    			form.getClientId());
    								
		MissatgeAjax missatge = new MissatgeAjax("cu.modificacio.success", null, Level.Success);
		ResultatAccioAjaxVO resultat = new ResultatAccioAjaxVO();
		resultat.addMessage(missatge);
		form.setResultat(resultat);    
	}

    /**
     * @see edu.uoc.tfc.gui.parts.modificacio.ModificaPartController#consultaPart(org.apache.struts.action.ActionMapping, edu.uoc.tfc.gui.parts.modificacio.ConsultaPartForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
     */
    public final void consultaPart(ActionMapping mapping, edu.uoc.tfc.gui.parts.modificacio.ConsultaPartForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
    {
    	form.setPart(
    			getPartService().getPart(form.getId()));
    }


}